import 'package:flutter/material.dart';
import 'package:flutter_widget/src/config/assets.dart';
import 'package:flutter_widget/src/config/color_define.dart';
import 'package:flutter_widget/src/widget/tap_widget.dart';

/*加载失败，点击重试页面*/
class FailWidget extends StatelessWidget {
  final void Function()? onPressed;
  final String? message;

  const FailWidget({Key? key, required this.onPressed, this.message})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: TapWidget(
          onTap: () {
            onPressed?.call();
          },
          child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
            FWAssets.emptyIcon,
            Padding(
              padding: const EdgeInsets.fromLTRB(0, 12, 0, 0),
              child: Text(
                message ?? '对不起，你访问的内容失联了(*＞﹏＜*)',
                style: const TextStyle(
                  color: FWColorPicker.textFFAAAAAA,
                  fontSize: 14,
                  decoration: TextDecoration.none,
                ),
              ),
            ),
          ]),
        ),
      ),
    );
  }
}
